<?php

/**
 * Parameters
 * @param $organizational_unit OrganizationalUnit
 * @param $form MemberForm
 * @param $form_errors array
 */

	use_stylesheets_for_form($form);
	use_javascripts_for_form($form);
	use_helper('Form');

?>

		<form id="member_form" action="<?php echo url_for('member_'.($form->getObject()->isNew() ? 'create' : 'update'), array('sf_subject' => $form->getObject(), 'unit' => $organizational_unit)) ?>" method="post" class="form uniform label-top" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?>>
			<?php if (!$form->getObject()->isNew()): ?>
			<input type="hidden" name="sf_method" value="put" />
			<?php endif; ?>
			<?php echo $form->renderHiddenFields(); ?>
			<?php echo $form->renderGlobalErrors(); ?>
			
			<div class="x8">
				
				<div class="tab_container">
					<ul class="tabs">
						<li><a href="#profil_stammdaten">Stammdaten</a></li>
						<li><a href="#profil_kontaktdaten">Kontaktdaten</a></li>
						<li><a href="#profil_pfadfinderdaten">Pfadfinderdaten</a></li>
						<li><a href="#profil_kontodaten">Kontodaten</a></li>
					</ul>
					
					<div class="tab_content_container">
						
						<div id="profil_stammdaten" class="tab_content">
							<div class="field stammdaten_vorname">
								<?php echo $form['first_name']->renderLabel();?>
								<?php echo $form['first_name']->render();?>
							</div>
							<div class="field stammdaten_nachname">
								<?php echo $form['last_name']->renderLabel();?>
								<?php echo $form['last_name']->render();?>
							</div>
							<div class="field stammdaten_geschlecht">
								<?php echo $form['gender']->renderLabel();?>
								<?php echo $form['gender']->render();?>
							</div>
							<div class="field stammdaten_vorname">
								<?php echo $form['PersonalData']['date_of_birth']->renderLabel('Geburtsdatum');?>
								<?php echo $form['PersonalData']['date_of_birth']->render();?>
							</div>
							<div class="field adresse_4">
								<?php echo $form['PersonalData']['birthplace']->renderLabel('Geburtsort');?>
								<?php echo $form['PersonalData']['birthplace']->render();?>
							</div>
							<div class="field adresse_1">
								<?php echo $form['PersonalData']['Addresses'][0]['street']->renderLabel();?>
								<?php echo $form['PersonalData']['Addresses'][0]['street']->render();?>
							</div>
							<div class="field adresse_2">
								<?php echo $form['PersonalData']['Addresses'][0]['street_number']->renderLabel();?>
								<?php echo $form['PersonalData']['Addresses'][0]['street_number']->render();?>
							</div>
							<div class="field adresse_3">
								<?php echo $form['PersonalData']['Addresses'][0]['zip_code']->renderLabel();?>
								<?php echo $form['PersonalData']['Addresses'][0]['zip_code']->render();?>
							</div>
							<div class="field adresse_4">
								<?php echo $form['PersonalData']['Addresses'][0]['city']->renderLabel();?>
								<?php echo $form['PersonalData']['Addresses'][0]['city']->render();?>
							</div>
							<div class="field">
								<?php echo $form['PersonalData']['Addresses'][0]['country_id']->renderLabel();?>
								<?php echo $form['PersonalData']['Addresses'][0]['country_id']->render();?>
							</div>
						</div>
						
						<div id="profil_kontaktdaten" class="tab_content">
							<?php foreach($form['PersonalData']['PhoneNumbers'] as $i => $sub_form):?>
							<div class="field kontaktdaten_vorwahl">
								<?php echo $sub_form['area_code']->renderLabel('Vorwahl');?>
								<?php echo $sub_form['area_code']->render();?>
							</div>
							<div class="field kontaktdaten_nummer">
								<?php echo $sub_form['call_through']->renderLabel();?>
								<?php echo $sub_form['call_through']->render();?>
							</div>
							<?php endforeach;?>
							<div class="field">
								<?php echo $form['PersonalData']['email_address']->renderLabel('Email-Adresse');?>
								<?php echo $form['PersonalData']['email_address']->render();?>
							</div>
						</div>
						
						<div id="profil_pfadfinderdaten" class="tab_content">
							<div class="field stammdaten_vorname">
								<?php echo $form['OrganizationalData']['date_of_joining']->renderLabel('Eintrittsdatum');?>
								<?php echo $form['OrganizationalData']['date_of_joining']->render();?>
							</div>
							<div class="field adresse_4">
								<?php echo $form['OrganizationalData']['date_of_resignation']->renderLabel('Austrittsdatum');?>
								<?php echo $form['OrganizationalData']['date_of_resignation']->render();?>
							</div>
							<div class="field stufe">
								<?php echo $form['OrganizationalData']['age_group_id']->renderLabel('Stufe');?>
								<?php echo $form['OrganizationalData']['age_group_id']->render();?>
							</div>
							<div class="field gruppe">
								<?php echo $form['OrganizationalData']['organizational_unit_id']->renderLabel('Zugehörigkeit');?>
								<?php echo $form['OrganizationalData']['organizational_unit_id']->render();?>
							</div>
							<div class="field halstuch">
								<?php echo $form['OrganizationalData']['scarf']->renderLabel('Halstuch');?>
								<div class="controlset-pad">
								<?php echo $form['OrganizationalData']['scarf']->render();?>
								</div>
							</div>
							<div class="field knotenschild">
								<?php echo $form['OrganizationalData']['woggle_id']->renderLabel('Knotenschild');?>
								<?php echo $form['OrganizationalData']['woggle_id']->render();?>
							</div>
						</div>
						
						<div id="profil_kontodaten" class="tab_content">
							<div class="field">
								<?php echo $form['PersonalData']['BankAccount']['owner']->renderLabel('Kontoinhaber');?>
								<?php echo $form['PersonalData']['BankAccount']['owner']->render();?>
							</div>
							<div class="field">
								<?php echo $form['PersonalData']['BankAccount']['number']->renderLabel('Kontonummer');?>
								<?php echo $form['PersonalData']['BankAccount']['number']->render();?>
							</div>
							<div class="field">
								<?php echo $form['PersonalData']['BankAccount']['bank_code']->renderLabel('Bankleitzahl');?>
								<?php echo $form['PersonalData']['BankAccount']['bank_code']->render();?>
							</div>
							<div class="field">
								<?php echo $form['PersonalData']['BankAccount']['bank']->renderLabel('Bank');?>
								<?php echo $form['PersonalData']['BankAccount']['bank']->render();?>
							</div>
						</div>
					
					</div>
				
				</div>
			
			</div>
			
			<div class="x4">
				
				<?php if(count($form_errors) > 0):?>
					<?php include_partial('global/form_error_list', array('form_errors' => $form_errors));?>
				<?php endif;?>
				
				<h2 class="box">Werkzeugbox<img alt="Werkzeugbox" src="<?php echo image_path('icons/content_werkzeugbox.png');?>" /></h2>
				<table class="box_table subnavigation">
					<tbody>
						<tr>
							<td><a href="#" onClick="document.forms['member_form'].submit();return false;"><img alt="&Auml;nderungen speichern" src="<?php echo image_path('icons/content_subnavigation_speichern.png');?>" />&Auml;nderungen speichern</a></td>
						</tr>
						<tr>
							<td><a href="<?php echo url_for('organizational_unit_portal', $organizational_unit)?>"><img alt="Abbrechen und zur &Uuml;bersicht" src="<?php echo image_path('icons/content_subnavigation_zurueck.png');?>" />Abbrechen</a></td>
						</tr>
					</tbody>
				</table>
			</div>
			
			<?php if (sfConfig::get('sf_environment') == 'test'): ?>
				<input type="submit" name="submit" value="submit" />
			<?php endif;?>
			
		</form>